package org.scratchcrew.domain;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Scratch Entity.
 * 
 * @author tsachev
 * 
 */
@Entity
@Table(name = "t_scratches")
@AttributeOverrides(value = { @AttributeOverride(column = @Column(name = "scratch_id"), name = "id") })
public class Scratch extends BaseEntity {

	@ManyToOne
	@JoinColumn(nullable = false, name = "board_data_id")
	private BoardData boardData;

	@Lob
	@Column(name = "static_data", nullable = false)
	private String staticData;

	@OneToOne(fetch = FetchType.EAGER, mappedBy="scratch")
	private ScratchData scratchData;

	public BoardData getBoardData() {
		return boardData;
	}

	public void setBoardData(BoardData boardData) {
		this.boardData = boardData;
	}

	public String getStaticData() {
		return staticData;
	}

	public void setStaticData(String staticData) {
		this.staticData = staticData;
	}

	public ScratchData getScratchData() {
		return scratchData;
	}

	public void setScratchData(ScratchData scratchData) {
		this.scratchData = scratchData;
	}
}
